﻿package mortal.mvc.core
{
    import mortal.game.cache.*;
    import mortal.mvc.interfaces.*;

    public class Controller extends Object implements IController
    {
        protected var cache:Cache;
        protected var _view:IView;

        public function Controller()
        {
            this.cache = Cache.instance;
            this.initServer();
            return;
        }// end function

        public function get view() : IView
        {
            if (this._view == null)
            {
                this._view = this.initView();
            }
            return this._view;
        }// end function

        public function set view(param1:IView) : void
        {
            this._view = param1;
            return;
        }// end function

        protected function initServer() : void
        {
            return;
        }// end function

        protected function initView() : IView
        {
            return this._view;
        }// end function

        public function get isViewShow() : Boolean
        {
            return this._view && !this._view.isHide;
        }// end function

        protected function isInitView() : Boolean
        {
            if (this._view)
            {
                return true;
            }
            return false;
        }// end function

        public function popup() : void
        {
            return;
        }// end function

    }
}
